<!-- 设备管理-设备管理-设备台账 -->
<template>
  <div class="JNPF-common-layout">
    <div class="JNPF-common-layout-center">
      <el-row class="JNPF-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>

          <el-col :span="6">
            <el-form-item label="设备商">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="仓库">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options2"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="固定资产码">
              <el-input v-model="listQuery.fbillno" placeholder="固定资产码" clearable />
            </el-form-item>
          </el-col>
    
          <template v-if="showAll">
      
          <el-col :span="6">
            <el-form-item label="设备名称">
              <el-input v-model="listQuery.fbillno" placeholder="设备名称" clearable />
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="设备序号">
              <el-input v-model="listQuery.fsrcbillno" placeholder="设备序号" clearable />
            </el-form-item>
          </el-col>

            <el-col :span="6">
              <el-form-item label="设备状态">
                <el-select v-model="listQuery.fbillstate" placeholder="请选择">
                  <el-option
                  v-for="item in options4"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
                </el-select>
              </el-form-item>
            </el-col>

          </template>
          <el-col :span="8">
            <el-form-item label="">
              <el-button type="primary" icon="el-icon-search" >查询</el-button>
              <!-- <el-button type="success" icon="el-icon-plus" @click="insert(undefined)">新增</el-button> -->
              <el-button type="success" icon="el-icon-download">导出</el-button>
              <el-button type="text" icon="el-icon-arrow-down" @click="showAll = true" v-if="!showAll">展开</el-button>
              <el-button type="text" icon="el-icon-arrow-up" @click="showAll = false" v-else>
                收起</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <div class="JNPF-common-layout-main JNPF-flex-main">
        <JNPF-table :data="list" border v-loading="loading">
          <el-table-column prop="FSUPPLIER" label="设备商" ></el-table-column>
          <el-table-column prop="FPOINT" label="仓库名称"></el-table-column>
          <el-table-column prop="FNUM" label="固定资产码"></el-table-column>
          <el-table-column prop="FCATNO" label="设备序列号" ></el-table-column>
          <el-table-column prop="FCATNAME" label="设备名称" ></el-table-column>
          <el-table-column prop="FBRAND" label="设备品牌" ></el-table-column>
          <el-table-column prop="FSPEC" label="设备型号" ></el-table-column>
          <el-table-column prop="FBILLSTATE" label="设备状态" ></el-table-column>
          <el-table-column fixed="left" label="操作" align="center" width="100">
            <template slot-scope="scope">
              <el-button type="text" @click="insert(scope.row.FBILLNO)" size="small" icon="el-icon-view">
                查看
              </el-button>
            </template>
          </el-table-column>
        </JNPF-table>
        <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"/>
        <Form ref="Form"  :formationlist="customlist" />
      </div>
    </div>
  </div>
</template>
<script>
  import Form from "./Form.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    name: 'shop',
    components: { Form },
    data() {
      return {
        showAll: false,

        //所属教学楼选择数据
        options1: [{
          value: '1',
          label: '广州福兴实验室设备科技'
        }, {
          value: '2',
          label: '江苏艾普瑞实验设备有限公司'
        }, {
          value: '3',
          label: '山东德瑞克仪器股份有限公司'
        }],

        //所属楼层选择数据
        options2: [{
          value: '1',
          label: '杭州仓库'
        }, {
          value: '2',
          label: '宁波仓库'
        }],

        //所属校区选择数据
        options4: [{
          value: 'L001',
          label: '在库'
        }, {
          value: 'L002',
          label: '工作'
        }, {
          value: 'L003',
          label: '维护'
        }, {
          value: 'L004',
          label: '保养'
        }, {
          value: 'L005',
          label: '故障'
        }, {
          value: 'L006',
          label: '维修'
        }, {
          value: 'L007',
          label: '报废'
        }],

        customlist:[
          {
            "FBILLNO": "1001",
            "FBILLNAME": "物理化学",
            "FTEACH": "秦始皇",
            "FBILLTYPE": "走班课程",
            "FBILLSTATE": "正常",
            "FMEMO": ""
          },
        ],
        list: [
            {
            "FSUPPLIER":"广州福兴实验室设备科技",
            "FPOINT":"宁波仓库",
            "FNUM":"2412080000008",
            "FCATNO":"XL-89-23981",
            "FCATNAME":"智慧迷你手环",
            "FBRAND":"迷你",
            "FSPEC":"SH-2004-01",
            "FQTY":103,
            "FBILLSTATE":"工作"
            },{
            "FSUPPLIER":"广州福兴实验室设备科技",
            "FPOINT":"宁波仓库",
            "FNUM":"2412080000009",
            "FCATNO":"KT-89-23981",
            "FCATNAME":"智慧迷你摄像机",
            "FBRAND":"迷你",
            "FSPEC":"SH-2004-09",
            "FQTY":187,
            "FBILLSTATE":"工作"
            }
            ,{
            "FSUPPLIER":"广州福兴实验室设备科技",
            "FPOINT":"宁波仓库",
            "FNUM":"2412080000010",
            "FCATNO":"XL-89-23931",
            "FCATNAME":"车载GPS设备",
            "FBRAND":"迷你",
            "FSPEC":"GPS-2003-21",
            "FQTY":78,
            "FBILLSTATE":"工作"
            },{
            "FSUPPLIER":"广州福兴实验室设备科技",
            "FPOINT":"宁波仓库",
            "FNUM":"2412080000011",
            "FCATNO":"XL-89-23998",
            "FCATNAME":"4G物联网摄像头",
            "FBRAND":"迷你",
            "FSPEC":"VI-8004-01",
            "FQTY":93,
            "FBILLSTATE":"工作"
            },
        ],
        fbillcredate: [jnpf.dateFormat(new Date(), "YYYY-MM-DD"), jnpf.dateFormat(new Date(), "YYYY-MM-DD")],
        loading: false,
        total: 0,
        listQuery: {
          page: 1,
          limit: 20,
          sort: "desc",
          sidx: "",
          fbillstate: "",
          fbillno: "",
          begindate: undefined,
          enddate: undefined,
          fcustomno: ""
        },
      };
    },
    computed: {},
    methods: {
      insert(id) {
        this.$refs.Form.init(id);
      },
    },
  };
</script>